#define _CRT_SECURE_NO_WARNINGS
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
#include<stdio.h>
#include<stdbool.h>
bool is_selfDividing(int num) {
    int cur = num;
    while (cur)
    {
        int tmp = cur % 10;
        cur /= 10;
        if (tmp && num % tmp)
            return false;
    }
    return true;
}

int* selfDividingNumbers(int left, int right, int* returnSize) {
    int* arr = (int*)malloc(100 * sizeof(int));
    int k = 0;
    for (int i = left; i <= right; i++)
    {
        if (is_selfDividing(i))
        {
            *returnSize++;
            arr[k++] = i;
        }
    }
    return arr;
}

int main()
{
    int num = 0;
    int* arr = selfDividingNumbers(1, 22, &num);
    return 0;
}